package weixin.popular.api;

import org.junit.Test;

import net.sf.json.JSONObject;

public class QrcodeAPI extends BaseAPI {

	public static String getQrCode(String token){
		String url = BASE_URI + "/cgi-bin/qrcode/create?access_token="+token;
		String str ="{\"action_name\": \"QR_LIMIT_STR_SCENE\", \"action_info\": {\"scene\": {\"scene_str\": \"test\"}}}";
		JSONObject jsonObject = httpRequest(url, "POST", str);
		return jsonObject.getString("url");
	}
	
	@Test
	public void testAPI(){
		String token = "14_BWluKDO3pz3TWO6adheM2mGX59lbj7EqXfAcW80yVcN6Ymn01X8lZB5sMPwp5EHa9WKp_d7hqv9m8I1v4U_rAV07WtVd3m_OXCjmK3wkJtxiR14VLqaub5TmP_gBFBdAIAIMI";
		String url = getQrCode(token);
		System.err.println(url);
	}
	
}
